package com.ycu.jk16.mall.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ycu.jk16.mall.dao.OrderDao;
import com.ycu.jk16.mall.dao.OrderDetailDao;
import com.ycu.jk16.mall.domain.Order;
import com.ycu.jk16.mall.domain.OrderDetail;
import com.ycu.jk16.mall.service.OrderService;

/**
 * 
 * @ClassName OrderServiceImpl
 * @Description TODO(这里用一句话描述这个类的作用)
 * @author 倪宗龙
 * @date 2018年12月18日 下午2:19:31
 * @version V1.0
 */
@Service("orderService")
public class OrderServiceImpl implements OrderService {
	/**
	 * 注入持久层对象
	 */
	@Autowired
	private OrderDao orderDao;
	@Autowired
	private OrderDetailDao orderDetailDao;

	@Override
	public Order findOrderByNo(String no) {
		return orderDao.selectByNo(no);
	}

	@Override
	public List<OrderDetail> findOrderDetailListByNo(String no) {
		return orderDetailDao.selectDetailByNo(no);
	}

	@Override
	public List<Order> getOrdersWithParams(Map<String, Object> params) {
		return orderDao.selectOrderWithParams(params);
	}

	@Override
	public void addOrder(Order order, List<OrderDetail> orderDetails, Integer userId) {
		orderDao.addOrder(order, orderDetails, userId);
	}
	
	public Integer countOrder() {
		return orderDao.countOrder();
	}
}
